﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Media;

namespace app
{
    public class ViewModel
    {
        Watch watch = new Watch();
        ImageFileServices imageServices = new ImageFileServices();
        DrawImage drawImage = new DrawImage();

        //ImageSource altImgSource;

        public ViewModel()
        {
            imageServices.initImg();
        }

        internal void startWatch()
        {
            watch.startWatch();
        }
        
        internal void stopWatch()
        {
            watch.stopWatch();
        }

        internal void imageLoadToFile()
        {
            imageServices.imageLoadToFile();
        }

        internal void imageSaveAsFile(Image img)
        {
            imageServices.SaveBitmapToFile(imageServices.imageRender(img));
        }

        internal void GrayimageCreate()
        {
            drawImage.initialize(100,100,1);
            drawImage.CreateGrayImageData(drawImage.Width, drawImage.Height, drawImage.ImgData);
            drawImage.ImageDataToBitmap();
            drawImage.WriteableBitmapToImageSource();
        }

        internal void ColorimageCreate()
        {
            drawImage.initialize(100, 100, 4);
            drawImage.CreateColorImageData(drawImage.Width, drawImage.Height, drawImage.ImgData);
            drawImage.ImageDataToBitmap();
            drawImage.WriteableBitmapToImageSource();
        }

        public Watch Watch
        {
            get { return watch; }
            set { watch = value; }
        }
        public ImageFileServices ImageServices
        {
            get { return imageServices; }
            set { imageServices = value; }
        }
        public DrawImage DrawImage
        {
            get { return drawImage; }
            set { drawImage = value; }
        }
    }
}
